/* Base Styles */
:root {
    --primary-color: #333;
    --secondary-color: #666;
    --background-color: #fff;
    --border-color: #ddd;
    --accent-color: #007bff;
}

body {
    font-family: monospace;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: var(--background-color);
    color: var(--primary-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Typography */
h1, h2 {
    text-align: center;
    margin-bottom: 1rem;
}

.description {
    text-align: center;
    color: var(--secondary-color);
    margin-bottom: 2rem;
}

/* Sections */
section {
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* File Upload */
.upload-container {
    text-align: center;
    padding: 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    margin-bottom: 1rem;
}

.preview-container {
    margin-top: 1rem;
}

#image-preview {
    max-width: 100%;
    max-height: 300px;
    margin: 1rem auto;
}

/* ASCII Output */
.ascii-container {
    font-family: 'Courier New', monospace;
    white-space: pre;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ascii-line {
    display: flex;
    justify-content: center;
    white-space: pre;
}

.ascii-char {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-color);
    border-top: 5px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    section {
        padding: 0.5rem;
    }
}

/* Animation Preview */
.animation-container {
    text-align: center;
    margin: 1rem 0;
}

/* Form Styles */
.config-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.form-group {
    margin: 0;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    box-sizing: border-box;
    font-family: 'Courier New', monospace;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-primary:active {
    background-color: #004085;
    border-color: #004085;
}

/* Range Input Styling */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    outline: none;
    margin: 1rem 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    transition: background .2s;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    transition: background .2s;
    border: none;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #0056b3;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #0056b3;
}

/* Animation Container */
.animation-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.animation-container img {
    max-width: 100%;
    height: auto;
    margin-bottom: 1rem;
}

/* Density Display */
.density-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    color: var(--secondary-color);
    font-size: 0.875rem;
}

/* State Configuration */
.state-entries {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

.state-entry {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: #f8f9fa;
}

.state-entry label {
    width: 80px;
    margin: 0;
}

.state-entry .state-char {
    width: 60px;
    text-align: center;
    font-family: monospace;
    cursor: pointer;
}

.state-entry .state-color {
    width: 60px;
    padding: 0;
    height: 38px;
    cursor: pointer;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.state-entry .remove-state {
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    color: #dc3545;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

.state-entry .remove-state:hover {
    color: #bd2130;
}

.state-controls {
    max-width: 600px;
    margin: 1rem auto;
    text-align: center;
}

/* Character Selection Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: relative;
    background-color: #fff;
    margin: 10% auto;
    padding: 1rem;
    width: 90%;
    max-width: 600px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
}

.close {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
    cursor: pointer;
}

.close:hover {
    color: var(--primary-color);
}

.char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
    padding: 1rem;
}

.char-grid-item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-family: monospace;
    transition: all 0.2s ease-in-out;
}

.char-grid-item:hover {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.mt-4 {
    margin-top: 2rem;
}

/* Debug Mode Styles */
.debug-toggle-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 1000;
}

.debug-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    margin: 0;
}

.debug-toggle-label input[type="checkbox"] {
    cursor: pointer;
}

.debug-log {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 400px;
    max-height: 600px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #00ff00;
    font-family: monospace;
    font-size: 12px;
    padding: 12px;
    border-radius: 4px;
    overflow-y: auto;
    z-index: 999;
}

.debug-log div {
    margin-bottom: 4px;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    .debug-log {
        width: 90%;
        max-height: 400px;
        font-size: 11px;
    }
    
    .debug-toggle-container {
        bottom: 10px;
        right: 10px;
    }
}

/* ... existing code ... */ 